<?php

namespace App\Http\Middleware;

use App\model\Website;
use Closure;

class Gun
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        if (auth('api')->user()&&auth('api')->user()->tiyan==1&&Website::find(1)->is_display==1){

            return \Response::json([
                'code'=>1,
                'message'=>'无权限'
            ]);
        }
        return $next($request);
    }

}
